home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7880 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1007 b   |  36 lines

  1. Newsgroups: comp.lang.c++
  2. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!cronkite!news
  3. From: Marco DeFreitas <mdefreitas@sikorsky.com>
  4. Subject: New operator
  5. Content-Type: text/plain; charset=us-ascii
  6. Message-ID: <1996Feb14.022723.6407@cronkite.res.utc.com>
  7. Sender: news@cronkite.res.utc.com
  8. Nntp-Posting-Host: iris604.asi.sikorsky.com
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Sikorsky Aircraft
  11. Mime-Version: 1.0
  12. Date: Wed, 14 Feb 1996 02:27:23 GMT
  13. X-Mailer: Mozilla 1.1S (X11; I; IRIX 5.3 IP12)
  14. X-Url: news:comp.lang.c++
  15.  
  16. If I use the explicit placement form of new to create an object from
  17. some specified memory, can I delete it?  
  18.  
  19. char     buf[100];
  20. Object  *obj;
  21.  
  22.    obj = new (buf) Object;
  23.    delete obj;
  24.  
  25.  
  26. What actually happens?  I tried it on an SGI version of C++ and it does
  27. not complain - but is this legal?  Is it really doing a delete of my buf?
  28. Or is the delete being ignored.   Thanks in advance for any input.
  29.  
  30. -- 
  31. Regards,
  32. Marco DeFreitas
  33. Sikorsky Aircraft
  34. Stratford, CT
  35.  
  36.